package binary

type ByteOrder interface {
	Int16([]byte) int16
	Int32([]byte) int32
}

var BigEndian ByteOrder = &bigEndian{}

type bigEndian struct{}

func (b *bigEndian) Int16(bytes []byte) int16 {
	_ = bytes[1]
	return (int16(bytes[0]) << 8) | int16(bytes[1])
}

func (b *bigEndian) Int32(bytes []byte) int32 {
	_ = bytes[3]
	return (int32(bytes[0]) << 24) | (int32(bytes[1]) << 16) | (int32(bytes[2]) << 8) | int32(bytes[3])
}
